package com.example.test.主方法运行测试;

import java.util.Arrays;

public class MaxNum {
    public static void main(String[] args) {
        int count = 3;
        String str = "13 312 343";
        sort(count, str);
    }

    private static void sort(int count, String str) {
        String[] split = str.split(" ");
        if (split.length != count) {
            return;
        }

        int[] arr = Arrays.stream(split).mapToInt(Integer::parseInt).toArray();

        for (int i = 0; i < arr.length; i++) {
            for (int j = i + 1; j < arr.length; j++) {
                int temp;
                if (arr[i] < arr[j]) {
                    temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }
        }

        StringBuffer result = new StringBuffer();
        for (int i = 0; i < arr.length; i++) {
            result.append(arr[i]);
        }
        System.out.println(result);
    }


}
